$(function () {
    menuFormValid();
});
function menuFormValid() {
    $("#menuForm").validate({
        rules: {
            b_menuCode: {
                required: true,
            },
            b_menuName: {
                required: true,
                minlength: 3,
            },
            b_titleInfo:{
                required: true,
                minlength: 3,
            },
            b_menuUrl:{
                url:true
            },
            b_rowSort:{
                number:true
            }
        },
        errorPlacement: function(error, element) {
            error.appendTo(element.parent());
        },
        errorElement: "span",
        errorClass: "errortips",
        success: 'valid',
        messages: {
            b_menuCode: {
                required: " (必填)",
                minlength: " (不能少于 3 个字母)",
            },
            b_menuName: {
                required: " (必填)",
                minlength: " (不能少于 3 个字母)",
            },
            b_titleInfo:{
                required: " (必填)",
                minlength: " (不能少于 3 个字母)"
            },
            b_menuUrl:{
                url: " 请输入正确的url",
            },
            b_rowSort:{
                number: "请输入数字"
            }
        },
    });
}

function submitForm() {
    if($('#menuForm').valid()){
        return false;
    }
    return {};
}
